package test;

import java.util.ArrayList;

import javax.swing.text.html.HTMLDocument.Iterator;

import user.User;
import user.UserDao;
import user.User;
/**
 * userdao的测试类
 * @author xieyihong
 *
 */
public class Uerdao_dome {
   public static void main(String[] args) {
	   //注册
	/*User XieYiHong = new User("XieYiHong","147896325");
	XieYiHong.setSex("男");
	XieYiHong.setFavourite("电脑娱乐");
	XieYiHong.setProfession("学生");
	XieYiHong.setNote("谢一弘");
	UserDao dao = new UserDao();
	dao.setUser(XieYiHong);
	int result = dao.doRegister();
     System.out.println(result);*/
	   //判断用户是否存在
	  UserDao dao = new UserDao();
	   boolean result = dao.isExistsUname("system");
	   System.out.println(result);
	   //重置密码
	  /* UserDao dao = new  UserDao();
	   int result = dao.doResetPassword(22);
	   System.out.println(result);*/
	   //根据用户名得到该用户全部信息
	 /*  UserDao dao = new UserDao();
	   ArrayList<User> list = dao.doSelectByUname("XieYiHong");
	   java.util.Iterator<User> it = list.iterator();
	   while(it.hasNext()){
	   	
	   	User user = it.next();
	   	int uid = user.getUid();
	   	String sex = user.getSex();
	   	if(sex.equals("1")){
	   		sex="女";
	   	}
	   	else{
	   		sex="男";
	   	}
	   	int type =user.getType();
	   	String type_s;
	   	if(type == 0){
	   		type_s="普通用户";
	   	}
	   	else{
	   		type_s="管理员";
	   	}
	   	int isValid =user.getIsValid();
	   	String isValid_s;
	   	if(isValid == 0){
	   		isValid_s="无效";
	   	}
	   	else{
	   		isValid_s="有效";
	   	}
	   	System.out.println(uid);
	   	System.out.println(user.getUname());
	   	System.out.println(sex);
	   	System.out.println(user.getProfession());
	   	System.out.println(user.getFavourite());
	   	System.out.println(type_s);*/
	   //修改用户的状态
	  /* UserDao dao = new UserDao();
	   int result = dao.doChangeState(22);
	   System.out.println(result);*/
	   //修改用户的权限
	   /*UserDao dao = new UserDao();
	   int result = dao.doChangePower(22);
	   System.out.println(result);*/
	   
}
   }
   
